package com.haipumi.listeners;


import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.haipumi.biz.TaskBiz;
import com.haipumi.biz.impl.TaskBizImpl;
import com.haipumi.utils.CommonData;

public class TaskCountListener implements ServletContextListener{
	
	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		//查询所有的任务数
		TaskBiz tb=new TaskBizImpl();
		int count=tb.findTaskCount();
		//如何取出application
		
		ServletContext application=arg0.getServletContext();
		application.setAttribute(CommonData.APPLICATIONTASKCOUNT, count);
	}
}
